#pragma once
#ifndef SAMPLER_H
#define SAMPLER_H

#include "basic_typedef.h"
#include "CollisionDetector.h"
#include <CGAL/Cartesian.h>
#include <iostream>

class SingleRobotSampler
{
public:
	
	////////////////////////
	// CTORS
	////////////////////////
	/*	Parameters:
			radius	- radius of robot
			Room	- describes the boundary of the scenario
			CollisionDetector	- Collision detection black box
			*/

	SingleRobotSampler(int robot_index,
		Polygon_2 robot_polygon,
		Room room,
		CollisionDetector *col,
		double seed = -1);

	~SingleRobotSampler(void){};

	////////////////////////
	// Queries
	////////////////////////

	/*	Samples a point in the configuration space of the robot
		defined by the bounding box of the scenario.
		This point can be valid or invalid.	*/
	Point_2 generate_sample();
	Point_2 generate_free_sample();

	// room variables
	double xmin;
	double xmax;
	double ymin;
	double ymax;
	double lenx;
	double leny;
	int _robot_index;
	CollisionDetector *_col;
};

class MultiRobotsSampler
{
public:

	MultiRobotsSampler(Polygon_2 robot_1_polygon,
					   Polygon_2 robot_2_polygon,
					   Room room,
					   CollisionDetector *col,
					   double seed = -1);

	~MultiRobotsSampler(void){};

	ConfSet generate_free_sample();

	ConfSet generate_sample();
	Point_d generate_sample_point_d();
	Point_d generate_free_sample_point_d();

private:

	////////////////////////
	// Data Members
	////////////////////////
	CollisionDetector*				m_col;	// Collision detector
	SingleRobotSampler*				m_robot_1_sampler_ptr;
	SingleRobotSampler*				m_robot_2_sampler_ptr;
};

#endif